<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3c.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core">

<ui:composition template="template/template.xhtml">
	<ui:define name="content">

		<h:form id="form">
			<p:dataTable id="cars" var="user" value="#{userController.users}"
				rowKey="#{user.name}" selection="#{userController.selectedUser}"
				selectionMode="single">

				<f:facet name="header">
	            Click "View" button after selecting a row to see details  
	        </f:facet>

				<p:column headerText="Name">
	            #{user.name}  
	        </p:column>

				<p:column headerText="Email">
	            #{user.email}  
	        </p:column>

				<f:facet name="footer">
					<p:commandButton id="viewButton" value="View" icon="ui-icon-search"
						update=":form:display" oncomplete="carDialog.show()" />
				</f:facet>

			</p:dataTable>

			<p:dialog id="dialog" header="Car Detail" widgetVar="carDialog"
				resizable="false" width="400" showEffect="clip" hideEffect="fold">

				<h:panelGrid id="display" columns="2">
					<h:outputText value="Name:" />
					<!-- <h:outputText value="#{userController.selectedUser.name}" /> -->
					<h:inputText value="#{userController.selectedUser.name}" />

					<h:outputText value="Email:" />
					<h:inputText value="#{userController.selectedUser.email}" />
				</h:panelGrid>
			</p:dialog>
		</h:form>

	</ui:define>
</ui:composition>
</html>